#include "Gun.h"

const char* Gun::GUN_MODEL_PATH = "media/models/Chaingunner/chaingunner_weapon.md2";
Gun::Gun(int numeroTiros,Array pos)
{
    numeroTirosSimultaneos = numeroTiros;
    position(pos);
    pMira = new Aim();
    pBala = new Bullet();
    init();
}
void Gun::init()
{
    load(Gun::GUN_MODEL_PATH);
    appear();
    inactiveBody();
}
void Gun::hide()
{
    visible(false);
    pMira->hide();
}
void Gun::appear()
{
    visible(true);
    pMira->appear();
}
void Gun::shot(Array direcao,double velocidade)
{
    SoundSource::shotSound.play();
    pBala->appear();
    pBala->position(position());
    pBala->velocity(direcao * velocidade);

}
